package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;


/*
*根据属性实现 Bean 对象注入
 */
@Controller
public class UserController2 {

    // 对象注入方式1：属性注入
    @Autowired
    private UserService userService;

    public void sayHi(){
        userService.sayHi();
    }
}
